home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d3
/
histry50.arc
/
HISTORY.DOC
next >
Wrap
Text File
|
1988-04-05
|
14KB
|
327 lines
HISTORY PC Version 5.0
Description
HISTORY is a program for PC-DOS 2.0 and later (there is also
a version for the DEC Rainbow) which allows the user to recall,
edit, and reissue previously-typed DOS commands. If a mistake is
made on the command currently being entered but is not noticed
until after several more characters have been typed, the mistake
may be fixed without deleting the intervening characters.
Commands are saved in a 512-byte FIFO buffer. The number of
commands that can be saved in the buffer depends on their length.
When the buffer becomes full, one or more of the oldest commands
are evicted to make room for a new command. If a new command is
identical to the immediately preceding command, it is not
duplicated in the history buffer.
The user steps back and forth through old commands using the
up- and down-arrow keys. Up-arrow recalls the most recent
command, another up-arrow the second most recent, and so forth.
Down-arrow moves forward in the buffer. Both movements are
circular -- when up-arrow reaches the oldest command another up-
arrow will return to the current command (the DOS prompt). An
initial down-arrow will move to the oldest command.
The left- and right-arrow keys may be used to move within a
line. Home moves to the beginning of the line, while End moves
back to the end. The Backspace key deletes the character to the
left of the cursor and the Del key deletes the character under
the cursor. Normal characters are inserted into the line. Other
editing commands are summarized below.
A line may be recalled by content by typing Alt-S; the user
is then prompted for an anchored search string. The history list
is searched backwards for the line beginning with the specified
string. To search for the next-most recent occurrence of the
string, the user merely hits Alt-F. As a shorthand for Alt-S,
Alt-X prompts for a single-character search string without a
carriage return; the selected string is automatically sent. The
string seleted by Alt-S or Alt-X is remembered between HISTORY
invocations. Subsequent uses of Alt-F use this string until
another is chosen. All searches wrap circularly.
Multiple DOS commands may be entered on one line by
separating them with a semi-colon. The commands will be sent one
at a time to DOS. A semicolon as the last character on the line
will be sent along (hello, MicroSoft). To enter a semicolon mid-
command, type two (one will be sent).
Other function key actions are described under "Function Key
Summary" below.
Immortal Commands
Up to 256 bytes of "immortal" commands make be loaded from
a file by specifying the file name as an argument when HISTORY is
loaded or by loading the file interactively with Alt-L. The
commands are immortal in that they are not deleted to make room
for new commands. The immortal commands remain at the top
(oldest) part of the buffer and thus are immediately accessible
via the down-arrow key. They may be searched for and otherwise
treated as any other commands.
The buffer is cleared before the file is loaded.
Aliases
Commands may be given an alias via the syntax
:alias replacement
Whenever the alias is typed at the start of the line, its
replacement is inserted in its place and the result sent to DOS.
For example given the aliases
:dw dir /w
:t type
in the command buffer, typing
dw
is equivalent to typing
dir /w
and
t fred
is equivalent to
type fred
Alias substitution is only done on the first word of a
command; multiple commands separated by semicolons will, however,
have alias substitution applied to each command. Substitution is
tried only once per command, thus
:dir dir /w
will not loop recursively but will give the desired result.
Aliases are usually loaded from a file of immortal commands
but may also be established interactively. Non-immortal aliases
eventually age and die, however.
If multiple definitions of the same alias exist, the first
one encountered searching from most recent to oldest is used. If
an alias is defined with no replacement string, e.g.
:dir
then this cancels the effect of older definitions of the same
alias; in this case dir is no longer an alias for something else.
Hot Keys
A special case of an alias is the Hot Key. A command may be
aliased as a function key. If the function key is then pressed
at the beginning of the line, the command is executed without
waiting for a carriage return. The alias must be a 2-character
hex code from the following table:
Key Code Key Code Key Code Key Code
F1 3B Alt-F1 68 Alt-A 1E Alt-Hyphen 82
F2 3C Alt-F2 69 Alt-B 30 Back-Tab 0F
F3 3D Alt-F3 6A Alt-C 2E
F4 3E Alt-F4 6B Alt-E 12
F5 3F Alt-F5 6C Alt-G 22
F6 40 Alt-F6 6D Alt-I 17
F7 41 Alt-F7 6E Alt-J 24
F8 42 Alt-F8 6F Alt-K 25
F9 43 Alt-F9 70 Alt-M 32
F10 44 Alt-F10 71 Alt-N 31
Sh-F1 54 Alt-1 78 Alt-P 19
Sh-F2 55 Alt-2 79 Alt-Q 10
Sh-F3 56 Alt-3 7A Alt-R 13
Sh-F4 57 Alt-4 7B Alt-T 14
Sh-F5 58 Alt-5 7C Alt-U 16
Sh-F6 59 Alt-6 7D Alt-V 2F
Sh-F7 5A Alt-7 7E Alt-W 11
Sh-F8 5B Alt-8 7F Alt-Y 15
Sh-F9 5C Alt-9 80 Alt-Z 2C
Sh-F10 5D Alt-0 81 Alt-= 83
These codes are cryptic, but a more user-friendly scheme would
consume precious dedicated memory. You may put a comment at the
end of the alias definition by preceding the comment by zero or
more spaces followed by two pound signs (##).
As an example, the following alias in the command buffer
:44 dir ## F10
would cause the dir command to be executed when F10 was pressed.
Installation
HISTORY is enabled by executing HISTORY.EXE once per boot,
typically from AUTOEXEC.BAT. It requires about 8K of dedicated
memory.
If an argument is present it is assumed to be the name of a
file containing immortal commands to read into the buffer. Only
the first 256 bytes will be read; it may, of course, be shorter
than that.
HISTORY works by trapping DOS function 0AH. Since programs
other than COMMAND.COM also use function 0AH, HISTORY must
distinguish COMMAND.COM from the crowd. It does this by
remembering the address of the very first program to call it
after it's been loaded; to insure that COMMAND.COM is the first
caller, make HISTORY the last command in AUTOEXEC.BAT or invoke
it manually.
Function Key Summary
Up-arrow or Move back through commands.
PgUp
Down-arrow or Move forward through commands.
PgDn
Left-arrow Move the cursor left one character.
Right-arrow Move the cursor right one character.
Home Move the cursor to the beginning of line.
End Move the cursor to the end of the line.
Cntrl-left Move the cursor left one word.
Cntrl-right Move the cursor right one word.
Backspace Delete the character before the cursor.
Del Delete the character under the cursor.
^PgUp Delete from start of previous word to cursor.
^PgDn Delete from cursor to start of next word.
Ctrl-Home Delete from the beginning of the line to the
cursor.
Ctrl-End Delete from the cursor to the end of the
line.
Ins Toggle insert/overstrike mode (starts each
time in insert mode).
Return Send the line.
Alt-S Select and find search string.
Shift-Alt-S Select and find search string and execute.
Alt-F Find next occurrence of string (remembered
between commands).
Shift-Alt-F Find search string and execute.
Alt-X Select and find one-character search string
and execute.
Alt-D Same as typing "EXIT"; useful for leaving
secondary COMMAND.COM's.
Alt-H Lists the contents of the history buffer,
oldest to most recent.
Shift-Alt-H Lists the contents of the history buffer,
most recent to oldest.
Alt-O Turns HISTORY off; commands are parsed via
normal DOS code until Control-Z followed by
Return is typed. HISTORY remains resident
in memory and the command buffer remains
intact.
Alt-L Promts for the name of a file of immortal
commands and loads that file.
; If not the last character on the line, splits
DOS commands. They are handed one at a time
to COMMAND.COM. If last on the line, it is
sent along as part of the command. To send a
semicolon mid-command, type two semicolons.
^C or ^X Delete the line being typed/edited.
Printer Considerations
When printing a file using the standard DOS print spooler
PRINT.COM, lines are sent to the printer only when awaiting DOS
input; since HISTORY bypasses DOS input when awaiting command
input, the printer will stop until a command is run.
Similarly, Control-P (printer toggle) will not be recognized
in HISTORY. The solution to both problems is to use Alt-O to turn
HISTORY off long enough for the file to print or to type
Control-P (once toggled on you may turn HISTORY back on; printing
will take place in this case).
To turn HISTORY back on, type Control-Z followed by Return.
Modification History
Version 2.6
A bug which caused the system to hang was fixed.
HISTORY properly handles long lines which wrap around two
rows.
Searches are now caseless.
The amount of dedicated memory required has been reduced.
Version 2.7
A bug associated with ^X was fixed.
Version 3.0
Immortal commands added. Labeled commands added.
If a command is identical to the immediately preceding
command, the second is not saved in the history buffer.
Version 3.1
Fixed a bug which caused immortal commands to be mortal.
Version 3.2
Fixed a bug which ocurred when backspacing over the response
to a prompt.
Version 3.3
Added delete-word commands.
Version 3.4
Made ^C behave like ^X.
Version 3.5
Replaced F10, F9, etc., with Alt keys. Added Shift-Alt-S
and Shift-Alt-S.
Version 4.0
Labeled commands replaced with aliasing.
Version 4.1
Alias substitution applied to semicolon-separated commands.
Version 5.0
Added Hot Keys. Added Shift-Alt-H (lists command buffer in
reverse order). Added alias cancel capability. ^C cancels
command buffer list.
Author, author
Copyright (c) 1985,86,87 by Bryan Higgins. All rights reserved,
except the right to copy for non-commercial use.
The author may be reached/rewarded at
1802 Channing Way
Berkeley, CA 94703
One of the Kramden Utilities.